package com.sky.mapper.admin;

import com.sky.dto.GoodsSalesDTO;
import com.sky.vo.OrderAmountByDaysVO;
import com.sky.vo.UserCollectVO;
import com.sky.vo.UserReportVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ReportMapper {
    /**
     * 营业额统计
     * @param begin
     * @param end
     * @return
     */
    List<OrderAmountByDaysVO> amountCollect(LocalDate begin, LocalDate end);
    List<OrderAmountByDaysVO> orderCollect(LocalDate begin, LocalDate end);

    List<GoodsSalesDTO> GoodsTop10(LocalDate begin, LocalDate end);

    Integer userTotalCollect(LocalDate yesterday);

    UserCollectVO UserNewCollect(LocalDate localDate);

    @Insert("insert into user_collect(`date`,total_user,new_user) values(#{date},#{totalUser},#{newUser})")
    void insertUserCollect(UserCollectVO userCollectVO);

    @Select("select * from user_collect where `date` between #{begin} and #{end}")
    List<UserCollectVO> userStatistics(LocalDate begin, LocalDate end);
}
